<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./echarts/echarts.min.js"></script>
</head>

<body>
    <!-- 必须带宽高的盒子才能渲染成功 -->
    <div id="main" style="width: 600px;height:400px;"></div>

    <script>
        // 初始化echarts
        const myChart = echarts.init(document.querySelector('#main'));

        // 指定图表的配置项和数据
        const option = {
            tooltip: {
                trigger: 'axis',
                position: function (pt) {
                    return [pt[0], '10%'];
                }
            },
            title: {
                left: '20',
                text: '2022全学科薪资走势'
            },

            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ["1月", "2月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
            },
            yAxis: {
                type: 'value',
                boundaryGap: [0, '100%']
            },

            series: [
                {
                    name: '薪资',
                    type: 'line',
                    symbol: 'emptyCircle',
                    symbolSize: "8",
                    smooth: "true",
                    sampling: 'lttb',
                    itemStyle: {
                        color: 'rgb(156, 196, 246)'
                    },
                    areaStyle: {
                        color: new echarts.graphic.LinearGradient(0, 0.5, 0, 0, [
                            {
                                offset: 0,
                                color: 'rgb(255, 255, 255)'
                            },
                            {
                                offset: 1,
                                color: 'rgb(145, 190, 244)'
                            }
                        ])
                    },
                    data: ["8888", "9999", "10000", "6000", "4500", "7800", "6900", "5400", "7900", "6500", "15000", "17000", "11000"]
                }
            ]
        };

        // 使用刚指定的配置项和数据显示图表。
        // 渲染到页面
        myChart.setOption(option);
    </script>
</body>

</html>